<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.springframework.org/schema/mvc">
<head>
<meta charset="UTF-8">
<title>用户注册</title>
</head>
<body bgcolor="#1E81C2">
	<div id="loginFormMain"
		style="width: 800px; height: 450px; border: 1px solid green; position: absolute; top: 50%; left: 50%; margin: -225px 0 0 -400px;">
		<table
			style="width: 800px; height: 450px; background-color: gray; text-align: center;">
			<tr>
				<th colspan="2" align="center">管理系统注册</th>
			</tr>
			<tr>
				<td>用户名:<input type="text" style="width: 200px; height: 30px;"
					id="username"></td>
			</tr>
			<tr>
				<td>密 码:<input type="password"
					style="width: 200px; height: 30px;" id="password"></td>
			</tr>
			<tr>
				<td align="center"><input type="button"
					style="cursor: pointer; font-style: inherit;" name="submit"
					onclick="return register();" value="注册"></td>
			</tr>
		</table>
	</div>
	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
	<script type="text/javascript">
		function register() {
			$.ajax({
				url : "/register",
				type : "POST",
				data : {
					'name' : $("#username").val(),
					'passwd' : $("#password").val()
				},
				async : false,
				success : function(data) {
					if (data.code == "200") {
						alert("success!");
					} else {
						alert("发生异常： " + data.message);
					}
				},
				error : function() {
					alert("error");
				}
			})
		}
	</script>
</body>
</html>
